package com.learn.xueer.ui.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.learn.xueer.R
import com.learn.xueer.data.model.bean.BookSectionResponse

class BookSectionAdapter(data: MutableList<BookSectionResponse>) :
    BaseQuickAdapter<BookSectionResponse, BaseViewHolder>(
        R.layout.item_book_section, data
    ) {
    override fun convert(holder: BaseViewHolder, item: BookSectionResponse) {
        holder.setText(R.id.title, item.name)
        val position = holder.adapterPosition
        if (data[position].id == data.last().id) {
            holder.setVisible(R.id.line, false)
        } else {
            holder.setVisible(R.id.line, true)
        }
    }
}